<template>
  <el-container style="height: 100%;">
    <el-aside width="250px" style="background-color: #f1f1f1;text-align: center">
      <el-avatar :src=storeIcon style="height: 100px;width: 100px;margin-top: 10px" ></el-avatar>
      <h3>{{storeName}}</h3>
      <el-menu
          default-active="img"
          class="el-menu-vertical-demo"
          :router="true"
      >
        <el-menu-item index="details">
          <i class="el-icon-s-shop"></i>
          <span slot="title">店铺详情</span>
        </el-menu-item>
        <el-menu-item index="storeProduct">
          <i class="el-icon-s-goods"></i>
          <span slot="title">商品列表</span>
        </el-menu-item>
        <el-menu-item index="storeOrder">
          <i class="el-icon-s-goods"></i>
          <span slot="title">订单列表</span>
        </el-menu-item>
      </el-menu>

      <el-button type="danger" round style="width: 200px;margin-top: 15px" @click="tuichu">退出登入</el-button>
    </el-aside>

    <el-main style="padding: 0px">
      <router-view />
    </el-main>

  </el-container>
</template>

<script>
import as from "@/axios/axios";

export default {
name: "Store",
  created() {
    this.getIcon()
  },
  data(){
  return {
    storeName:localStorage.getItem("storeName"),
    storeIcon:""
  }
  },
  methods:{
  //获取店铺icon
  getIcon(){
    as.post("/store/getId",{id:localStorage.getItem("storeId")}).then((res)=>{
      console.log(res)
      this.storeIcon = res.data.data.img
    })
  },
    tuichu(){
      localStorage.removeItem("token")
      localStorage.removeItem("storeName")
      localStorage.removeItem("storeId")
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped>

</style>